package de.sabram.upb.specs.serializer;

import com.google.inject.Inject;
import de.sabram.upb.specs.services.ConGrammarAccess;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.AlternativeAlias;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.GroupAlias;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.TokenAlias;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition;
import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer;

@SuppressWarnings("all")
public class ConSyntacticSequencer extends AbstractSyntacticSequencer {

	protected ConGrammarAccess grammarAccess;
	protected AbstractElementAlias match_ALT_SolidusKeyword_1_0_0_or_VerticalLineKeyword_1_0_1;
	protected AbstractElementAlias match_ElemList_AsteriskKeyword_0_3_0_q;
	protected AbstractElementAlias match_ElemList_CommercialAtKeyword_2_0_1_or_DollarSignKeyword_2_0_0;
	protected AbstractElementAlias match_ElemList_PlusSignKeyword_0_3_1_q;
	protected AbstractElementAlias match_ElemList___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__a;
	protected AbstractElementAlias match_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a;
	protected AbstractElementAlias match_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a_or_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p__a___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__;
	protected AbstractElementAlias match_ElemList_____AsteriskKeyword_0_3_0_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____PlusSignKeyword_0_3_1_q__a;
	protected AbstractElementAlias match_ElemList_____PlusSignKeyword_0_3_1_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____AsteriskKeyword_0_3_0_q__a;
	protected AbstractElementAlias match_RHS_SolidusSolidusKeyword_1_0_0_or_VerticalLineVerticalLineKeyword_1_0_1;
	protected AbstractElementAlias match_Rule_ColonColonEqualsSignKeyword_2_1_or_ColonKeyword_2_0;
	protected AbstractElementAlias match_Rule___IDTerminalRuleCall_0_0_EqualsSignKeyword_0_1__q;
	
	@Inject
	protected void init(IGrammarAccess access) {
		grammarAccess = (ConGrammarAccess) access;
		match_ALT_SolidusKeyword_1_0_0_or_VerticalLineKeyword_1_0_1 = new AlternativeAlias(false, false, new TokenAlias(false, false, grammarAccess.getALTAccess().getSolidusKeyword_1_0_0()), new TokenAlias(false, false, grammarAccess.getALTAccess().getVerticalLineKeyword_1_0_1()));
		match_ElemList_AsteriskKeyword_0_3_0_q = new TokenAlias(false, true, grammarAccess.getElemListAccess().getAsteriskKeyword_0_3_0());
		match_ElemList_CommercialAtKeyword_2_0_1_or_DollarSignKeyword_2_0_0 = new AlternativeAlias(false, false, new TokenAlias(false, false, grammarAccess.getElemListAccess().getCommercialAtKeyword_2_0_1()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getDollarSignKeyword_2_0_0()));
		match_ElemList_PlusSignKeyword_0_3_1_q = new TokenAlias(false, true, grammarAccess.getElemListAccess().getPlusSignKeyword_0_3_1());
		match_ElemList___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__a = new GroupAlias(true, true, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAmpersandKeyword_1_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getSTRINGTerminalRuleCall_1_1()), new AlternativeAlias(true, true, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAsteriskKeyword_0_3_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getPlusSignKeyword_0_3_1())));
		match_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a = new AlternativeAlias(true, true, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAsteriskKeyword_0_3_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getPlusSignKeyword_0_3_1()));
		match_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a_or_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p__a___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__ = new AlternativeAlias(false, false, new AlternativeAlias(true, true, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAsteriskKeyword_0_3_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getPlusSignKeyword_0_3_1())), new GroupAlias(false, false, new AlternativeAlias(true, true, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAsteriskKeyword_0_3_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getPlusSignKeyword_0_3_1())), new GroupAlias(true, false, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAmpersandKeyword_1_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getSTRINGTerminalRuleCall_1_1())), new GroupAlias(true, true, new AlternativeAlias(true, true, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAsteriskKeyword_0_3_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getPlusSignKeyword_0_3_1())), new GroupAlias(true, false, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAmpersandKeyword_1_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getSTRINGTerminalRuleCall_1_1()))), new AlternativeAlias(true, true, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAsteriskKeyword_0_3_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getPlusSignKeyword_0_3_1()))));
		match_ElemList_____AsteriskKeyword_0_3_0_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____PlusSignKeyword_0_3_1_q__a = new GroupAlias(true, true, new AlternativeAlias(false, false, new GroupAlias(false, false, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAmpersandKeyword_1_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getSTRINGTerminalRuleCall_1_1())), new TokenAlias(false, true, grammarAccess.getElemListAccess().getAsteriskKeyword_0_3_0())), new TokenAlias(false, true, grammarAccess.getElemListAccess().getPlusSignKeyword_0_3_1()));
		match_ElemList_____PlusSignKeyword_0_3_1_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____AsteriskKeyword_0_3_0_q__a = new GroupAlias(true, true, new AlternativeAlias(false, false, new GroupAlias(false, false, new TokenAlias(false, false, grammarAccess.getElemListAccess().getAmpersandKeyword_1_0()), new TokenAlias(false, false, grammarAccess.getElemListAccess().getSTRINGTerminalRuleCall_1_1())), new TokenAlias(false, true, grammarAccess.getElemListAccess().getPlusSignKeyword_0_3_1())), new TokenAlias(false, true, grammarAccess.getElemListAccess().getAsteriskKeyword_0_3_0()));
		match_RHS_SolidusSolidusKeyword_1_0_0_or_VerticalLineVerticalLineKeyword_1_0_1 = new AlternativeAlias(false, false, new TokenAlias(false, false, grammarAccess.getRHSAccess().getSolidusSolidusKeyword_1_0_0()), new TokenAlias(false, false, grammarAccess.getRHSAccess().getVerticalLineVerticalLineKeyword_1_0_1()));
		match_Rule_ColonColonEqualsSignKeyword_2_1_or_ColonKeyword_2_0 = new AlternativeAlias(false, false, new TokenAlias(false, false, grammarAccess.getRuleAccess().getColonColonEqualsSignKeyword_2_1()), new TokenAlias(false, false, grammarAccess.getRuleAccess().getColonKeyword_2_0()));
		match_Rule___IDTerminalRuleCall_0_0_EqualsSignKeyword_0_1__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getRuleAccess().getIDTerminalRuleCall_0_0()), new TokenAlias(false, false, grammarAccess.getRuleAccess().getEqualsSignKeyword_0_1()));
	}
	
	@Override
	protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
		if(ruleCall.getRule() == grammarAccess.getIDRule())
			return getIDToken(semanticObject, ruleCall, node);
		else if(ruleCall.getRule() == grammarAccess.getSTRINGRule())
			return getSTRINGToken(semanticObject, ruleCall, node);
		return "";
	}
	
	/**
	 * terminal ID  		: '^'?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
	 */
	protected String getIDToken(EObject semanticObject, RuleCall ruleCall, INode node) {
		if (node != null)
			return getTokenText(node);
		return "";
	}
	
	/**
	 * terminal STRING	: 
	 * 			"'" ( '\\' ('b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\') | !('\\'|"'") )* "'"
	 * 		;
	 */
	protected String getSTRINGToken(EObject semanticObject, RuleCall ruleCall, INode node) {
		if (node != null)
			return getTokenText(node);
		return "\'\'";
	}
	
	@Override
	protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) {
		if (transition.getAmbiguousSyntaxes().isEmpty()) return;
		List<INode> transitionNodes = collectNodes(fromNode, toNode);
		for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) {
			List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax);
			if(match_ALT_SolidusKeyword_1_0_0_or_VerticalLineKeyword_1_0_1.equals(syntax))
				emit_ALT_SolidusKeyword_1_0_0_or_VerticalLineKeyword_1_0_1(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ElemList_AsteriskKeyword_0_3_0_q.equals(syntax))
				emit_ElemList_AsteriskKeyword_0_3_0_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ElemList_CommercialAtKeyword_2_0_1_or_DollarSignKeyword_2_0_0.equals(syntax))
				emit_ElemList_CommercialAtKeyword_2_0_1_or_DollarSignKeyword_2_0_0(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ElemList_PlusSignKeyword_0_3_1_q.equals(syntax))
				emit_ElemList_PlusSignKeyword_0_3_1_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ElemList___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__a.equals(syntax))
				emit_ElemList___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__a(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a.equals(syntax))
				emit_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a_or_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p__a___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__.equals(syntax))
				emit_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a_or_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p__a___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ElemList_____AsteriskKeyword_0_3_0_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____PlusSignKeyword_0_3_1_q__a.equals(syntax))
				emit_ElemList_____AsteriskKeyword_0_3_0_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____PlusSignKeyword_0_3_1_q__a(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ElemList_____PlusSignKeyword_0_3_1_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____AsteriskKeyword_0_3_0_q__a.equals(syntax))
				emit_ElemList_____PlusSignKeyword_0_3_1_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____AsteriskKeyword_0_3_0_q__a(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_RHS_SolidusSolidusKeyword_1_0_0_or_VerticalLineVerticalLineKeyword_1_0_1.equals(syntax))
				emit_RHS_SolidusSolidusKeyword_1_0_0_or_VerticalLineVerticalLineKeyword_1_0_1(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Rule_ColonColonEqualsSignKeyword_2_1_or_ColonKeyword_2_0.equals(syntax))
				emit_Rule_ColonColonEqualsSignKeyword_2_1_or_ColonKeyword_2_0(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Rule___IDTerminalRuleCall_0_0_EqualsSignKeyword_0_1__q.equals(syntax))
				emit_Rule___IDTerminalRuleCall_0_0_EqualsSignKeyword_0_1__q(semanticObject, getLastNavigableState(), syntaxNodes);
			else acceptNodes(getLastNavigableState(), syntaxNodes);
		}
	}

	/**
	 * Syntax:
	 *     '/' | '|'
	 */
	protected void emit_ALT_SolidusKeyword_1_0_0_or_VerticalLineKeyword_1_0_1(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     '*'?
	 */
	protected void emit_ElemList_AsteriskKeyword_0_3_0_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     '$' | '@'
	 */
	protected void emit_ElemList_CommercialAtKeyword_2_0_1_or_DollarSignKeyword_2_0_0(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     '+'?
	 */
	protected void emit_ElemList_PlusSignKeyword_0_3_1_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ('&' STRING ('*' | '+')*)*
	 */
	protected void emit_ElemList___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__a(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ('*' | '+')*
	 */
	protected void emit_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ('*' | '+')* | (('*' | '+')* ('&' STRING)+ (('*' | '+')* ('&' STRING)+)* ('*' | '+')*)
	 */
	protected void emit_ElemList___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a_or_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p_____AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1__p__a___AsteriskKeyword_0_3_0_or_PlusSignKeyword_0_3_1__a__(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     (('*'? | ('&' STRING)) '+'?)*
	 */
	protected void emit_ElemList_____AsteriskKeyword_0_3_0_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____PlusSignKeyword_0_3_1_q__a(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ((('&' STRING) | '+'?) '*'?)*
	 */
	protected void emit_ElemList_____PlusSignKeyword_0_3_1_q_or___AmpersandKeyword_1_0_STRINGTerminalRuleCall_1_1_____AsteriskKeyword_0_3_0_q__a(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     '//' | '||'
	 */
	protected void emit_RHS_SolidusSolidusKeyword_1_0_0_or_VerticalLineVerticalLineKeyword_1_0_1(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     '::=' | ':'
	 */
	protected void emit_Rule_ColonColonEqualsSignKeyword_2_1_or_ColonKeyword_2_0(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     (ID '=')?
	 */
	protected void emit_Rule___IDTerminalRuleCall_0_0_EqualsSignKeyword_0_1__q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
}
